﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ReminderView.aspx.cs" Culture="en-GB"
    Inherits="Main_Master_ReminderView" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Src="~/User Controls/Pager.ascx" TagPrefix="custom" TagName="Pager" %>
<%@ Register Src="~/User Controls/CommonControls.ascx" TagName="CommonControls" TagPrefix="MyControls" %>
<%@ Register Assembly="CalendarExtenderPlus" Namespace="AjaxControlToolkitPlus" TagPrefix="advancedCalender" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Reminder View</title>
    <link href="../../Styles/accounts.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" language="javascript">
  function checkdate() {
           if (document.getElementById("txtfrom").value == '') {
                alert('Specify From date!');
                document.getElementById("txtfrom").focus();
                return false;
            }
            else if (document.getElementById("txtto").value == '') {
                alert('Specify To Date!');
                document.getElementById("txtto").focus();
                return false;
            }
            else {
                var strFromDate = document.getElementById("txtfrom").value;
                var strToDate = document.getElementById("txtto").value;
                var dtFrom = parseInt(strFromDate.substring(0, 2), 10);
                var monFrom = parseInt(strFromDate.substring(3, 5), 10);
                var yrFrom = parseInt(strFromDate.substring(6, 10), 10);
                var dtTo = parseInt(strToDate.substring(0, 2), 10);
                var monTo = parseInt(strToDate.substring(3, 5), 10);
                var yrTo = parseInt(strToDate.substring(6, 10), 10);
                var dateFrom = new Date(yrFrom, monFrom, dtFrom);
                var dateTo = new Date(yrTo, monTo, dtTo);
                if (dateTo < dateFrom) {
                    alert("from date cannot be greater than to date");
                    document.getElementById("txtfrom").focus();
                    return false;
                }
                else {
                    return true;
                }
            }            
        } 
         function EnabledTabKey(id, e) {
            var keycode;
            if (window.event) {
                keycode = window.event.keyCode;
            }
            else if (e) {
                keycode = e.which;
            }
            else {
                return true;
            }

            if (keycode == 9) {
                // if is the tab key                
                return true;
            }
            else {
                return false;
            }
        }      
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="scriptmanger1" runat="server">
    </asp:ScriptManager>
    <acc:heading ID="pagehead" runat="server" HeadingText="Reminder View" />
    <div style="width: 90%; margin-left: 5%; margin-right: 5%">
        <asp:Label ID="lblMsg" runat="server"></asp:Label>
        <asp:Panel ID="pnlDate" runat="server" Width="100%">
            <table class="tablecontent" align="center" style="width: 100%;">
                <tr>
                    <td align="right" style="padding-top: 5px;">
                        From&nbsp;&nbsp;<asp:TextBox ID="txtFrom" CssClass="input" runat="server"></asp:TextBox>
                        <asp:ImageButton ID="btnDateFrom" runat="server" ImageUrl="~/Images/calendar.gif" />
                        <%--  <advancedCalender:CalendarExtenderPlus ID="calFromDate" runat="server" PopupButtonID="btnDateFrom"
                        Format="dd/MM/yyyy" TargetControlID="txtFrom">
                        </advancedCalender:CalendarExtenderPlus>--%>
                        <ajaxcontrol:calendarextender id="cal1" runat="server" popupbuttonid="btnDateFrom"
                            targetcontrolid="txtFrom" format="dd/MM/yyyy" enabled="True">
                        </ajaxcontrol:calendarextender>
                        <ajaxcontrol:maskededitextender id="maskExt1" runat="server" masktype="Date" mask="99/99/9999"
                            targetcontrolid="txtFrom" enabled="True">
                        </ajaxcontrol:maskededitextender>
                        <ajaxcontrol:maskededitvalidator id="maskValid1" runat="server" controlextender="maskExt1"
                            invalidvaluemessage="Invalid Date !" display="Dynamic" validationgroup="V" controltovalidate="txtFrom"
                            errormessage="maskValid"></ajaxcontrol:maskededitvalidator>
                    </td>
                    <td style="padding-top: 5px;">
                        &nbsp;&nbsp;&nbsp;To&nbsp;&nbsp;<asp:TextBox ID="txtTo" runat="server" CssClass="input"></asp:TextBox>
                        <asp:ImageButton ID="btnDateTo" runat="server" ImageUrl="~/Images/calendar.gif" />
                        <%-- <advancedCalender:CalendarExtenderPlus ID="calToDate" runat="server" PopupButtonID="btnDateTo"
                        Format="dd/MM/yyyy" TargetControlID="txtTo">
                       </advancedCalender:CalendarExtenderPlus>--%>
                        <ajaxcontrol:calendarextender id="cal2" runat="server" popupbuttonid="btnDateTo"
                            targetcontrolid="txtTo" format="dd/MM/yyyy" enabled="True">
                        </ajaxcontrol:calendarextender>
                        <ajaxcontrol:maskededitextender id="maskExt2" runat="server" masktype="Date" mask="99/99/9999"
                            targetcontrolid="txtTo" enabled="True">
                        </ajaxcontrol:maskededitextender>
                        <ajaxcontrol:maskededitvalidator id="maskValid2" runat="server" controlextender="maskExt2"
                            invalidvaluemessage="Invalid Date !" display="Dynamic" validationgroup="V" controltovalidate="txtTo"
                            errormessage="maskValid"></ajaxcontrol:maskededitvalidator>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClientClick="return checkdate()"
                            CssClass="button" ValidationGroup="V" OnClick="btnSubmit_Click" />
                    </td>
                    <td align="left">
                        &nbsp;<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click"
                            CssClass="button" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <asp:Panel ID="pnlGrid" runat="server">
            <div style="padding-top: 15px; padding-bottom: 5px; margin-left: 30%;">
                <div style="float: left;">
                    <custom:Pager ID="custPager" runat="server" OnPageChanged="custPager_PageChanged" />
                </div>
                <div style="float: left; margin-left: 10px;">
                    <%--<MyControls:CommonControls ID="CommonControls2" runat="server" GridviewControlId="grdDisplay"
                        HideColumns="8,9" />--%>
                </div>
            </div>
            <div id="divprint" runat="server">
                <asp:GridView ID="grdDisplay" Width="100%" runat="server" AutoGenerateColumns="false"
                    CssClass="gridview" AllowPaging="true" AlternatingRowStyle-CssClass="gridview_alternate"
                    PagerStyle-CssClass="pgr" DataKeyNames="id" OnPageIndexChanging="grdDisplay_OnPageIndexChanging"
                    RowStyle-CssClass="gridviewitem" FooterStyle-CssClass="gridviewitem" OnRowDataBound="grdDisplay_RowDataBound"
                    OnRowCreated="grdDisplay_RowCreated">
                    <Columns>
                        <asp:TemplateField HeaderText="S.No." ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%# Container.DataItemIndex+1 %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField HeaderText="Voucher Type" DataField="type" />
                        <asp:BoundField HeaderText="Reminder Name" DataField="Name" />
                        <asp:BoundField HeaderText="Debit Ledger" DataField="DEBIT_LID" />
                        <asp:BoundField HeaderText="Credit Ledger" DataField="CREDIT_LID" />
                        <asp:BoundField HeaderText="Status" DataField="ISACTIVE" />
                        <asp:TemplateField HeaderText="Details" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:LinkButton ID="lnkView" runat="server" Text="View"></asp:LinkButton>
                                <asp:Panel ID="Panel1" runat="server" Width="90%" Style="display: none; text-align: center;"
                                    BorderWidth="2px" CssClass="modalPopup" Height="200px">
                                    <div align="center" style="float: right;">
                                        <asp:LinkButton ID="lnkBtnClose" runat="server" Text="Close"></asp:LinkButton></div>
                                    <div align="center" style="padding-top: 5px">
                                   
                                        <table class="tablecontent" runat="server" width="100%">
                                        <tr>
                                        <td colspan="4" align="center">
                                        <b> <asp:Label ID="lblCompName" runat="server"></asp:Label></b>
                                        </td>
                                        </tr>
                                        <tr>
                                                <td colspan="4">
                                                    &nbsp;
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" style="width: 20%;">
                                                    <b>Voucher Type</b>
                                                </td>
                                                <td align="left" style="width: 30%;">
                                                    <asp:Label ID="lblVouType" runat="server"></asp:Label>
                                                </td>
                                                <td align="right" style="width: 20%;">
                                                    <b>Date</b>
                                                </td>
                                                <td align="left" style="width: 30%;">
                                                    <asp:Label ID="lblRemDate" runat="server"></asp:Label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="4">
                                                    &nbsp;
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" style="width: 20%;">
                                                    <b>Debit Leder</b>
                                                </td>
                                                <td align="left" style="width: 30%;">
                                                    <asp:Label ID="lblDebitLedger" runat="server"></asp:Label>
                                                </td>
                                                <td align="right" style="width: 20%;">
                                                    <b>Credit Ledger</b>
                                                </td>
                                                <td align="left" style="width: 30%;">
                                                    <asp:Label ID="lblCreditLedger" runat="server"></asp:Label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="4">
                                                    &nbsp;
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" style="width: 20%;">
                                                    <b>Alert Before Days</b>
                                                </td>
                                                <td align="left" style="width: 30%;">
                                                    <asp:Label ID="lblAlertBeforeDays" runat="server"></asp:Label>
                                                </td>
                                                <td align="right" style="width: 20%;">
                                                    <b>Is Active</b>
                                                </td>
                                                <td align="left" style="width: 30%;">
                                                    <asp:Label ID="lblIsActive" runat="server"></asp:Label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="4">
                                                    &nbsp;
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" style="width: 20%;">
                                                    <b>Frequency</b>
                                                </td>
                                                <td align="left" style="width: 30%;">
                                                    <asp:Label ID="lblFrequency" runat="server"></asp:Label>
                                                </td>
                                                <td align="right" style="width: 20%;">
                                                <b>Remarks</b>
                                                </td>
                                                <td align="left" style="width: 30%;">
                                                <asp:Label ID="lblRemarks" runat="server"></asp:Label>
                                                </td>
                                            </tr>
                                              <tr>
                                                <td colspan="4">
                                                    &nbsp;
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" style="width: 20%;">
                                                    <b>Activate From </b>
                                                </td>
                                                <td align="left" style="width: 30%;">
                                                    <asp:Label ID="lblActivateFrom" runat="server"></asp:Label>
                                                </td>
                                                <td align="right" style="width: 20%;">
                                                <b></b>
                                                </td>
                                                <td align="left" style="width: 30%;">
                                                <asp:Label ID="Label2" runat="server"></asp:Label>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </asp:Panel>
                                <ajaxcontrol:modalpopupextender id="MPE_ViewClass" runat="server" cancelcontrolid="lnkBtnClose"
                                    targetcontrolid="lnkView" backgroundcssclass="modalBackground" popupcontrolid="Panel1" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Action" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:HyperLink ID="lnkEdit" NavigateUrl='<%# Eval("id","ReminderEdit.aspx?reminderID={0}") %>'
                                    runat="server"><img src="../../Menu/images/Edit_user.png" alt="Edit"/></asp:HyperLink>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataRowStyle ForeColor="Red" Font-Bold="true" HorizontalAlign="Center" />
                    <EmptyDataTemplate>
                        Record Not Found !
                    </EmptyDataTemplate>
                </asp:GridView>
            </div>
        </asp:Panel>
    </div>
    </form>
</body>
</html>
